"For what is a Digger rather than a Duplicator. (abstract)"
Icon = (ico_dict['ico_mapdups'], 1)
def readvalues(self):
pass
def makeneg(self, item):
if not (item.type in (':e', ':b')):
if self.dup["global"]:
item["neg"]="g"
else:
item["neg"]="1"
class Digger(DiggingDuplicator):
"Makes everything in the group negative."
def do(self, item):
self.makeneg(item)
return [item]
class DepthDuplicator(DiggingDuplicator):
"Digger with a 'depth' parameter. (abstract)"
def readvalues(self):
self.depth = float(self.dup["depth"])
if self.depth<=0:
raise "depth<=0"
def applylinear(self, matrix, direct=0):
depth = float(self.dup["depth"])
factor = math.exp(math.log(abs(matrix))/3)
self.dup["depth"] = quarkx.ftos(depth*factor)
class HollowMaker(DepthDuplicator):
"Makes the polyhedrons in the group hollow."
def do(self, item):
item2 = item.copy()
item2.inflate(-self.depth)
self.makeneg(item2)
return [item, item2]
#
# a buildimages method for this is supplied in
# mapmiteredges.py, for mitered edges.
#
class WallMaker(DepthDuplicator):
"Extrude the polyhedrons in the group."
def do(self, item):
item2 = item.copy()
item.inflate(self.depth)
self.makeneg(item2)
return [item, item2]
#
# This plug-in introduces a new menu item for Duplicators : "Dissociate Duplicator images".
#
def dissociate1click(m):
editor = mapeditor()
if editor is None: return
getmgr = quarkpy.mapduplicator.DupManager
undo = quarkx.action()
list = editor.layout.explorer.sellist
list2=[]
for obj in list:
if obj.type == ':d':
list2.append(obj)
if obj["out"] and obj.parent is not None:
for item in obj.parent.subitems:
if item!=obj and item.type==':d' and item["out"]:
list2.append(item)
for obj in list2:
if obj.type == ':d':
mgr = getmgr(obj)
image = 0
insertbefore = obj.nextingroup()
while 1:
objlist = mgr.buildimages(image)
if len(objlist)==0:
break
image = image + 1
new = quarkx.newobj("%s (%d):g" % (obj.shortname, image))
for o in objlist:
new.appenditem(o)
undo.put(obj.parent, new, insertbefore)
undo.exchange(obj, None) # removes the duplicator
editor.ok(undo, "dissociate images")
dissociate = quarkpy.qmenu.item("Dissociate Duplicator images", dissociate1click,"|Dissociate Duplicator images:\n\nOnly active when you have selected a duplicator. This will create actural copies of the duplicator-object(s), and remove the duplicator itself.\n\nIf the duplicator is an 'out' duplicator, and there are others (immediately) in the group, they will all be dissociated together.|intro.mapeditor.menu.html#disdupimages")